Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <script src="loadxmldoc.js"> </script> </head> <body> <p><b>Note:</b> All major browsers, except Internet Explorer, treat empty white-spaces or new lines as text nodes. So, in the example below, there is a function that checks on node type, and displays only Element nodes. This way, the result will be equal in all browsers.</p> <script> xmlDoc = loadXMLDoc("books.xml"); x = xmlDoc.documentElement.childNodes; for (i=0; i<x.length; i++) { // Display only element nodes if (x.item(i).nodeType == 1) { document.write(x.item(i).nodeName); document.write("<br>"); } } </script> </body> <!-- Mirrored from www.w3schools.com/dom/tryit.asp?filename=try_dom_nodelist_item by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:22:40 GMT --> </html>
Result:
Try it Yourself - © w3schools.com